/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package EC;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author TrangNHIT
 */
@Entity
@Table(name = "tbBill")
@NamedQueries({
    @NamedQuery(name = "Bills.findAll", query = "SELECT b FROM Bills b"),
    @NamedQuery(name = "Bills.findByBillID", query = "SELECT b FROM Bills b WHERE b.billID = :billID"),
    @NamedQuery(name = "Bills.findByBillTotal", query = "SELECT b FROM Bills b WHERE b.billTotal = :billTotal")})
public class Bills implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "Bill_ID")
    private Integer billID;
    @Basic(optional = false)
    @Column(name = "Bill_Total")
    private double billTotal;
    @JoinColumn(name = "Tax_ID", referencedColumnName = "Tax_ID")
    @ManyToOne(optional = false)
    private Taxs taxs;
    @JoinColumn(name = "Order_ID", referencedColumnName = "Order_ID")
    @OneToOne(optional = false)
    private Orders orders;

    public Bills() {
    }

    public Bills(Integer billID) {
        this.billID = billID;
    }

    public Bills(Integer billID, double billTotal) {
        this.billID = billID;
        this.billTotal = billTotal;
    }

    public Integer getBillID() {
        return billID;
    }

    public void setBillID(Integer billID) {
        this.billID = billID;
    }

    public double getBillTotal() {
        return billTotal;
    }

    public void setBillTotal(double billTotal) {
        this.billTotal = billTotal;
    }

    public Taxs getTaxs() {
        return taxs;
    }

    public void setTaxs(Taxs taxs) {
        this.taxs = taxs;
    }

    public Orders getOrders() {
        return orders;
    }

    public void setOrders(Orders orders) {
        this.orders = orders;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (billID != null ? billID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Bills)) {
            return false;
        }
        Bills other = (Bills) object;
        if ((this.billID == null && other.billID != null) || (this.billID != null && !this.billID.equals(other.billID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "EC.Bills[billID=" + billID + "]";
    }

}
